<%@ page contentType="text/html; charset=utf-8" language="java"  errorPage="" %>
<%@ page import="com.appspot.niehonglei.action.ActionInterface"%>

<%!
	String actionPath = "com.appspot.niehonglei.action";
	String actions[] = {"SaveGuestBook",
		"SaveIndex",
		"DeleteIndex",
		"AdminLogin",
		"AdminLogout",
		"EditIndex",
		"SaveComment",
		"Rss",
		"DeleteComment",
		"SaveCommon",
		"DeleteCommon",
		"EditCommon",
		"DeleteComments"};
	int dealMethod(String method){
		int flag = -1;
		if(method!=null){
			for(int i=0;i<actions.length;i++){
				if((actions[i].substring(0,1).toLowerCase() + actions[i].substring(1,actions[i].length())).equals(method)){
					flag = i;
					break;
				}
			}			
		}
		return flag;
	}
%>
<%

	String method = request.getParameter("_action");
	int n = dealMethod(method);
	if(n!=-1){
		ActionInterface action = (ActionInterface)Class.forName(actionPath + "." + actions[n]).newInstance();
		action.execute(request,response);
	}
	

%>

